#include <unistd.h>
#include "sys.h"
#include "PCResource.h"

static void pcResourceExitCallback(void);

static PCResource *pcResource;
static mutex uiMutex;

int main(int argc, char *argv[])
{
    sys_init();
    lv_init(); // lvgl gui初始化
    lv_port_disp_init();
    lv_port_indev_init();
    lv_port_fs_init();

    pcResource = new PCResource(pcResourceExitCallback, uiMutex);

    while (1)
    {
        uiMutex.lock();
        uint32_t ms = lv_task_handler();
        uiMutex.unlock();

        usleep(ms * 1000);
    }
}


/**
 *@brief picture退出回调函数
 */
static void pcResourceExitCallback(void)
{
    delete pcResource;
    sys_exit();

    exit(0);
}
